
package ro.qi.framework.sys.mail.entities;

import java.util.Date;

import ro.qi.framework.sys.entities.Entity;

public class MailMessage extends Entity {

	public static final int STATE_ALL					= 0;
	public static final int STATE_NOT_SENT				= 1;
	public static final int STATE_SENT					= 2;
	public static final int STATE_WAIT					= 3;
	public static final int STATE_ERROR					= 4;
	
	public static final int PRIORITY_LOW				= -1;
	public static final int PRIORITY_NORMAL				= 0;
	public static final int PRIORITY_HIGH				= 1;

	public MailMessage() {
		super();
	}

	public MailMessage(int id) {
		super();
		setId(id);
		select();
	}

	public void setId(int value) {
		setValue("id", value);
	}

	public int getId() {
		return getIntValue("id");
	}

	public void setFrom(String value) {
		setValue("from", value);
	}

	public String getFrom() {
		return getStringValue("from");
	}

	public void setTo(String value) {
		setValue("to", value);
	}

	public String getTo() {
		return getStringValue("to");
	}

	public void setCc(String value) {
		setValue("cc", value);
	}

	public String getCc() {
		return getStringValue("cc");
	}

	public void setBcc(String value) {
		setValue("bcc", value);
	}

	public String getBcc() {
		return getStringValue("bcc");
	}

	public void setSubject(String value) {
		setValue("subject", value);
	}

	public String getSubject() {
		return getStringValue("subject");
	}

	public void setBody(String value) {
		setValue("body", value);
	}

	public String getBody() {
		return getStringValue("body");
	}

	public void setPriorityId(int value) {
		setValue("priority", value);
	}

	public int getPriorityId() {
		return getIntValue("priority");
	}

	public void setStatusId(int value) {
		setValue("state", value);
	}

	public int getStatusId() {
		return getIntValue("state");
	}

	public void setSentAt(Date value) {
		setValue("sentAt", value);
	}

	public Date getSentAt() {
		return getDateValue("sentAt");
	}

	public Date getCreateTime() {
		return getDateValue("createTime");
	}

	public Date getUpdateTime() {
		return getDateValue("updateTime");
	}

	public MessagePriority getPriority() {
		return new MessagePriority(getPriorityId());
	}

	public MessageStatus getStatus() {
		return new MessageStatus(getStatusId());
	}

	/*
	 * @deprecated
	 */
	public void setPriority(int value) {
		setValue("priority", value);
	}

	/*
	 * @deprecated
	 */
//	public int getPriority() {
//		return getIntValue("priority");
//	}

	/*
	 * @deprecated
	 */
	public void setState(int value) {
		setValue("state", value);
	}

	/*
	 * @deprecated
	 */
	public int getState() {
		return getIntValue("state");
	}

}
